<div class="mhead">
	<span>新闻列表</span>
</div>
  	
<div class="mcontent">	
	<div class="prompt">
		<?php echo $dora->message->all() ?>
	</div>
	<form id="data-form" method="post">
	<table class="table">
		<thead>
    		<tr>
    			<th width="30">选择</th>
            	<th width="200">标题</th>
            	<th width="140">创建时间</th>
            	<th width="200">操作</th>
            </tr>
    	</thead>
    	<tbody>
    		<?php foreach($house_list as $house) { ?>
    		<tr>
    			<td><input type="checkbox" name="id[]" value="<?php echo $house['id'] ?>" /></td>
            	<td><?php echo $house['name'] ?></td>
            	<td><?php echo $house['created'] ?></td>
            	<td>
            		<a href="house_update.php?id=<?php echo $house['id'] ?>">编辑</a>
            	</td>
            </tr>
            <?php } ?>
    	</tbody>
	</table>
	<input type="hidden" name="page" value="<?php echo $dora->pagination->paging ?>" />
	</form>
	
	<div class="blank1"></div>
	
	<div class="operate">
		<ul>
			<li><a class="all-selected-btu" href="javascript:void(0);">全选</a></li>
			<li><a class="all-unselected-btu" href="javascript:void(0);">取消</a></li>
			<li><a class="delete-btu" href="javascript:void(0);">删除</a></li>
		</ul>
		<div class="clr"></div>
	</div>
	
	<div class="blank1"></div>
	
	<div class="pagination">
		<?php echo $dora->pagination->do_page(); ?>
	</div>
	
	<div class="blank1"></div>
	
	
</div>

<link href="zonge-ui/components/flexigrid/css/flexigrid/flexigrid.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="zonge-ui/components/flexigrid/flexigrid.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$('.table').flexigrid({
		height:'auto',
		showToggleBtn:false
	});

	$('.all-selected-btu').click(function(){
		$("input[name='id[]']").attr("checked", true);
	});
	
	$('.all-unselected-btu').click(function(){
		$("input[name='article_id[]']").attr("checked", false);
	});

	$('.delete-btu').click(function(){
		var url = "house_delete.php";
		submit_form(url);
	});

	function submit_form(url) {
		var count = 0;
		var selected_id = $("input[name='id[]']");
		$.each( selected_id, function(i, n){
			if( $(n).attr("checked")) {
				count++;
			}
		});
		if( count <= 0 ) {
			alert("请选择文章！");
			return;
		}
		
		var form = $("#data-form").get(0);
		form.action = url;
		form.submit();
	}
});
</script>